﻿using System;
using System.Collections.Generic;
using AcademicPlanner.Data.Entities;
using NHibernate.Tool.hbm2ddl;
using NHibernate;

namespace AcademicPlanner.Data.Repositories
{
	/// <summary>
	/// UserEntityRepository serves as the repository for <c>UserEntity</c>s.
	/// </summary>
	/// <version>1.0</version>
	/// <since>1.0</since>
	public class UserEntityRepository : EntityRepository<UserEntity>
    {
		private UserEntityRepository() 
		{ 
			namedQueriesPrefix = "UserEntity";
		}

		private class InstanceHolder 
		{
			internal static UserEntityRepository INSTANCE = new UserEntityRepository(); 
		}


		/// <summary>
		/// The the single instance of UserEntityRepository.
		/// </summary>
		/// <returns>The single instance of UserEntityRepository.</returns>
		/// <version>1.0</version>
		/// <since>1.0</since>
		public static UserEntityRepository GetInstance()
		{ 
			return InstanceHolder.INSTANCE; 
		}


		/// <summary>
		/// Creates a new <c>UserEntity</c> and sets its default values.
		/// </summary>
		/// <returns>The newly created <c>UserEntity</c>.</returns>
		/// <seealso cref="M:AcademicPlanner.Data.Entities.UserEntity.SetDefaults"/>
		/// <version>1.0</version>
		/// <since>1.0</since>
		public UserEntity GetNew()
		{
			var rEnt = new UserEntity();
			rEnt.SetDefaults();
			return rEnt;
		}
    }
}
